package com.kobeliu.entity;

/**
 * 给定一个数组arr,一个值num，将小于等于num的值放到数组左边，大于num的值放到数组右边，
 */
public class Demo_8 {

    public static void main(String[] args) {

        int[] arr = {3,5,6,7,3,5,8};
        sortFunction(arr,5);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }


    }

    private static void sortFunction(int[] arr, int num) {

        int p = 0;
        int temp = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]<=num){
                temp = arr[p];
                arr[p] = arr[i];
                arr[i] = temp;
                p++;
            }
        }
    }

//    private static void swap(int src, int target) {
//        src = src ^ target;
//        target = src ^ target;
//        src = src ^ target;
//    }
}
